package Assignment.Test2_3;

public class Test {
    public static void main(String[] args) {
        Phone phone = new Phone("华为", 2700);
        show(phone);
        NewPhone newPhone = new NewPhone("Apple", 8300);
        show(newPhone);

        new Iplay(){
            @Override
            public void play() {
                System.out.println("英雄联盟");
            }
        }.play();

        Fun fun =new Fun(){
            @Override
            public void fun() {
                System.out.println("乐趣");
            }
        };
        fun.fun();



    }
    public static void show(Phone p) {
        p.call();
        p.note();
        if (p instanceof NewPhone np) {
            np.play();
        }
    }
}
